home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Archive / QuickTime / QuickTime VR / Make QTVR Panorama / CLogConsole.cp < prev    next >
Encoding:
Text File  |  2000-09-28  |  2.5 KB  |  110 lines  |  [TEXT/CWIE]

  1. /*
  2.     This file of empty stubs, copied from one included with CodeWarrior,
  3.     eliminates the need to include the Sioux libraries.
  4. */
  5.  
  6. #ifndef __CONSOLE__
  7. #include <console.h>
  8. #endif
  9.  
  10. /*
  11.  *    The following four functions provide the UI for the console package.
  12.  *    Users wishing to replace SIOUX with their own console package need
  13.  *    only provide the four functions below in a library.
  14.  */
  15.  
  16. /*
  17.  *    extern short InstallConsole(short fd);
  18.  *
  19.  *    Installs the Console package, this function will be called right
  20.  *    before any read or write to one of the standard streams.
  21.  *
  22.  *    short fd:        The stream which we are reading/writing to/from.
  23.  *    returns short:    0 no error occurred, anything else error.
  24.  */
  25.  
  26. short InstallConsole(short fd)
  27. {
  28. #pragma unused (fd)
  29.  
  30.     return 0;
  31. }
  32.  
  33. /*
  34.  *    extern void RemoveConsole(void);
  35.  *
  36.  *    Removes the console package.  It is called after all other streams
  37.  *    are closed and exit functions (installed by either atexit or _atexit)
  38.  *    have been called.  Since there is no way to recover from an error,
  39.  *    this function doesn't need to return any.
  40.  */
  41.  
  42. void RemoveConsole(void)
  43. {
  44. }
  45.  
  46. /*
  47.  *    extern long WriteCharsToConsole(char *buffer, long n);
  48.  *
  49.  *    Writes a stream of output to the Console window.  This function is
  50.  *    called by write.
  51.  *
  52.  *    char *buffer:    Pointer to the buffer to be written.
  53.  *    long n:            The length of the buffer to be written.
  54.  *    returns short:    Actual number of characters written to the stream,
  55.  *                    -1 if an error occurred.
  56.  */
  57.  
  58. long WriteCharsToConsole(
  59.     char *buffer, long n)
  60. {
  61.     
  62.     
  63.     return 0;
  64. }
  65.  
  66. /*
  67.  *    extern long ReadCharsFromConsole(char *buffer, long n);
  68.  *
  69.  *    Reads from the Console into a buffer.  This function is called by
  70.  *    read.
  71.  *
  72.  *    char *buffer:    Pointer to the buffer which will recieve the input.
  73.  *    long n:            The maximum amount of characters to be read (size of
  74.  *                    buffer).
  75.  *    returns short:    Actual number of characters read from the stream,
  76.  *                    -1 if an error occurred.
  77.  */
  78.  
  79. long ReadCharsFromConsole(char *buffer, long n)
  80. {
  81. #pragma unused (buffer, n)
  82.  
  83.     return 0;
  84. }
  85.  
  86. /*
  87.  *    extern char *__ttyname(long fildes);
  88.  *
  89.  *    Return the name of the current terminal (only valid terminals are
  90.  *    the standard stream (ie stdin, stdout, stderr).
  91.  *
  92.  *    long fildes:    The stream to query.
  93.  *
  94.  *    returns char*:    A pointer to static global data which contains a C string
  95.  *                    or NULL if the stream is not valid.
  96.  */
  97.  
  98. extern char *__ttyname(long fildes)
  99. {
  100. #pragma unused (fildes)
  101.     /* all streams have the same name */
  102.     static char *__devicename = "null device";
  103.  
  104.     if (fildes >= 0 && fildes <= 2)
  105.         return (__devicename);
  106.  
  107.     return (0L);
  108. }
  109.  
  110.